package com.sunny.ynhz.utils;
import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;

import com.sunny.ynhz.R;

/**
 * Created by mli on 2016/8/10.
 * http://hiapk.org
 */
public class DiagoUtils{


    private final Dialog dialog;

    public interface IClickEven {
        void onAgree();
        void onDisAgree();
        void onCheck();
    }

    public DiagoUtils(Context context, final IClickEven iClickEven) {
        View view = LayoutInflater.from(context).inflate(R.layout.pri_rule, null);
        dialog = new Dialog(context, R.style.style_loading_dialog);
        dialog.setContentView(view);
        view.findViewById(R.id.tv_agree).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                iClickEven.onAgree();

            }
        });
        view.findViewById(R.id.tv_not_agree).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                iClickEven.onDisAgree();

            }
        });
        view.findViewById(R.id.tv_check).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                iClickEven.onCheck();

            }
        });
    }

    public void showDigio() {
        dialog.show();
    }

    public void disDigio() {
        dialog.dismiss();
    }
}
